//
//  UIViewController+Extension.swift
//  LSWeibo1
//
//  Created by 李明禄 on 2018/12/6.
//  Copyright © 2018 SocererGroup. All rights reserved.
//

import UIKit

extension UIViewController {
    
    /// 判断是否为刘海屏
    /// iPhoneX、iPhoneXR、iPhoneXs、iPhoneXs Max等
    /// 判断刘海屏，返回true表示是刘海屏
    /// UIView中safeAreaInsets如果是刘海屏就会发生变化，普通屏幕safeAreaInsets恒等于UIEdgeInsetsZero
    
    var isNotchScreen: Bool {
        
        if #available(iOS 11.0, *) {
            if self.view.safeAreaInsets != UIEdgeInsets.zero {
                return true
            }
        }
        return false
    }
}

